import http from '@/utils/httpRequest'

/**
 * 删除地块
 * @param data
 */
export function deleteLand (data) {
  return http({
    url: '/api/affairs/landController/deleteLands',
    method: 'post',
    data
  })
}

/**
 * 获取农事任务列表
 * @param data
 */
export function queryTaskList (data) {
  return http({
    url: '/api/affairs/landController/selectLandList',
    method: 'post',
    data
  })
}

/**
 * 获取农事任务类型
 */
export function queryTaskType () {
  return http({
    url: '/api/uration/dict/data/type/plant_name',
    method: 'get'
  })
}

/**
 * 获取农事任务状态
 */
export function queryTaskStatusType () {
  return http({
    url: '/api/uration/dict/data/type/status',
    method: 'get'
  })
}

/**
 * 获取农事类型
 */
export function queryPlantType () {
  return http({
    url: '/api/uration/dict/data/type/plant_name',
    method: 'get'
  })
}

/**
 * 获取农事排序
 */
export function queryFarmingSort () {
  return http({
    url: '/api/uration/dict/data/type/land_sort',
    method: 'get'
  })
}

/**
 * 导入excel文件
 * @param data
 */
export function exportTaskTemplate (data) {
  return http({
    url: '/api/affairs/taskController/importTask',
    method: 'post',
    data
  })
}

/**
 * 下载批量导入农事任务Excel模板
 * @param params
 */
export function downTaskTemplate () {
  return window.SITE_CONFIG.baseUrl + '/api/affairs/taskController/downTaskTemplate'
}

/**
 * 获取种植人员
 */
export function queryPlanters () {
  return http({
    url: '/api/affairs/permissionController/selectPermissionList',
    method: 'get'
  })
}

/**
 * 获取巡田人员
 */
export function queryWatchPlanters () {
  return http({
    url: '/api/affairs/permissionController/selectInspectionList',
    method: 'get'
  })
}

/**
 * 获取地块列表
 */
export function queryLandList () {
  return http({
    url: '/api/affairs/taskController/downTaskTemplate',
    method: 'get'
  })
}

/**
 * 批量添加任务
 * @param data
 */
export function batchSaveTasks (data) {
  return http({
    url: '/api/affairs/taskController/saveTasks',
    method: 'post',
    data
  })
}

/**
 * 批量添加农事记录
 * @param data
 */
export function batchAddFarmRecord (data) {
  return http({
    url: '/api/affairs/taskController/saveRecord',
    method: 'post',
    data
  })
}

/**
 * 获取农事任务（农事一览）
 */
export function queryFarmEvent (data) {
  return http({
    url: '/api/affairs/taskController/selectTaskList',
    method: 'post',
    data
  })
}

/**
 * 通过id获取农事一览项详情
 * @param id
 */
export function queryFarmEventById (id) {
  return http({
    url: '/api/affairs/taskController/getTaskById/' + id,
    method: 'get'
  })
}

/**
 * 添加地块
 * @param data
 */
export function postFarmLand (data) {
  return http({
    url: '/api/affairs/landController/saveLand',
    method: 'post',
    data
  })
}
